﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dillema.example_to_agents
{
    class TheKiller : Agent
    {
<<<<<<< .mine
        int numberOfTrues, numberOfFalses, numberOfTurnes;
        double devideCalculation;
=======
        int numberOfOtherTrues, numberOfOtherFalses, numberOfTurnes, numberOfMyFalses, numberOfMyTrues;
        bool ans = true;
        double otherDevideCalculation, myDevideCalculation;
>>>>>>> .r10

        public bool Response(bool last_action)
        {
            bool ans = true;

<<<<<<< .mine
=======
            if (last_action)
                numberOfOtherTrues++;
            else
                numberOfOtherFalses++;
>>>>>>> .r10
            numberOfTurnes++;

            if (last_action)
            {
<<<<<<< .mine
                numberOfTrues++;
                devideCalculation = (double)numberOfTrues / (double)numberOfTurnes;
=======
                otherDevideCalculation = (double)numberOfOtherTrues / (double)numberOfTurnes;
>>>>>>> .r10
<<<<<<< .mine
=======

                //If the choice is less than 5% then opponent's last action could caused by noise,therefor forgive (!last_action).
                if (otherDevideCalculation <= 0.05)
                    ans = !last_action;
                else
                    ans = last_action;
>>>>>>> .r10
            }
            else
            {
<<<<<<< .mine
                numberOfFalses++;
                devideCalculation = (double)numberOfFalses / (double)numberOfTurnes;
=======
                otherDevideCalculation = (double)numberOfOtherFalses / (double)numberOfTurnes;
>>>>>>> .r10
<<<<<<< .mine
=======

                //If the choice is less than 5% then opponent's last action could caused by noise,therefor forgive (!last_action)..
                if (otherDevideCalculation <= 0.05)
                    ans = !last_action;
                else
                    ans = last_action;
>>>>>>> .r10
            }

<<<<<<< .mine
            //If the choice is less than 5% then opponent's last action could caused by noise,therefor forgive (!last_action).
            if (devideCalculation <= 0.05)
                ans = !last_action;
            else
                ans = last_action;
=======
            //+1 for this future false. Multiplication fo take in acount noise distribution
            myDevideCalculation = (((double)(numberOfMyFalses+1)*0.95)+((double)(numberOfMyTrues)*0.05)) / (double)(numberOfTurnes);
            if (myDevideCalculation < 0.05)
                ans = false;
>>>>>>> .r10

            if (!ans)
                numberOfMyFalses++;
            else
                numberOfMyTrues++;
            return ans;
        }

        public bool Reset()
        {

            numberOfOtherFalses = numberOfOtherTrues = numberOfTurnes = numberOfMyFalses = numberOfMyTrues = 0;

            numberOfMyTrues++;
            numberOfTurnes++;
            //First always T
            return true;
        }

    }
}
